@use '../style/base' as *;

@include bem(stepper) {
  @include b() {
    box-sizing: border-box;
    display: inline-flex;
    align-items: stretch;
    gap: var(--sar-stepper-gap);
    height: var(--sar-stepper-height);
    color: var(--sar-body-color);
  }

  @include e(button) {
    @include universal;
    flex: none;
    justify-content: center;
    align-items: center;
    width: var(--sar-stepper-height);
    font-size: var(--sar-stepper-button-font-size);
    background: var(--sar-stepper-bg);

    cursor: pointer;

    @include m(readonly) {
      cursor: unset;
    }

    @include m(disabled) {
      cursor: not-allowed;
    }

    @include m(decrease) {
      border-top-left-radius: var(--sar-stepper-button-border-radius);
      border-bottom-left-radius: var(--sar-stepper-button-border-radius);
    }

    @include m(increase) {
      border-top-right-radius: var(--sar-stepper-button-border-radius);
      border-bottom-right-radius: var(--sar-stepper-button-border-radius);
    }

    @include m-not(disabled, readonly) {
      &:active {
        background: var(--sar-stepper-button-active-bg);
      }
    }

    @include m(disabled) {
      background: var(--sar-disabled-shallow-bg);
      color: var(--sar-disabled-color);
    }
  }

  @include e(input) {
    flex: none;
    width: var(--sar-stepper-input-width);
    height: 100%;
    padding: 0 var(--sar-stepper-input-padding-x);
    border: 0;
    border-radius: 0;
    font-size: var(--sar-stepper-input-font-size);
    text-align: center;
    background: var(--sar-stepper-bg);
  }

  @include e(placeholder) {
    color: var(--sar-stepper-placeholder-color);
  }

  @include m(disabled) {
    @include e(input) {
      color: var(--sar-stepper-input-disabled-color);
    }
  }

  @include m(small) {
    height: var(--sar-stepper-height-sm);

    @include e(input) {
      width: var(--sar-stepper-input-width-sm);
      font-size: var(--sar-stepper-input-font-size-sm);
    }

    @include e(button) {
      width: var(--sar-stepper-height-sm);
      font-size: var(--sar-stepper-button-font-size-sm);
    }
  }
}
